Carbon


PBAllocContigAsync

Header: Files.h Carbon status: Supported

You can use the PBAllocContig function to allocate additional contiguous blocks to an open file.

OSErr PBAllocContigAsync (
    ParmBlkPtr paramBlock
);
paramBlock

A pointer to a basic File Manager parameter block.

function result

A result code.

DISCUSSION

The relevant fields of the parameter block are:

The PBAllocContigAsync function is identical to the PBAllocateAsync function except that if there isn’t enough contiguous empty space on the volume to satisfy the allocation request, PBAllocContigAsync does nothing and returns dskFulErr as its function result. If you want to allocate whatever space is available, even when the entire request cannot be filled by the allocation of a contiguous piece, call PBAllocateAsync instead.

The File Manager automatically allocates file blocks if you move the logical end-of-file past the physical end-of-file, and it automatically deallocates unneeded blocks from a file if you move the logical end-of-file to a position more than one allocation block before the current physical end-of-file. Consequently, you do not in general need to be concerned with allocating or deallocating file blocks. However, you can improve file block contiguity if you use the PBAllocContigAsync function to preallocate file blocks. This is most useful if you know in advance how big a file is likely to become.

PBAllocContig is not supported by AppleShare volumes. Instead, use SetEOF or PBSetEOFAsync to extend a file by setting the end-of-file.

AVAILABILITY

Supported in Carbon. Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.


© 2000 Apple Computer, Inc. — (Last Updated 5/8/2000)